﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Clipper.Model.EnumModel
{

    public class DetectEndStatusEnum
    {
        /// <summary>
        /// 检测类枚举类型设置  
        /// </summary>
        public enum DetectEndEnum
        {
            DETECTEND, //检测结束状态
            DETECTING  // 检测进行中
        }

        private ReaderWriterLockSlim rwlLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);

        private DetectEndEnum status = DetectEndEnum.DETECTING;

        public void setStatus(DetectEndEnum state)
        {
            rwlLock.EnterWriteLock();
            try
            {
                this.status = state;
            }
            finally
            {
                rwlLock.ExitWriteLock();
            }
        }


        public DetectEndEnum getStatus()
        {
            rwlLock.EnterReadLock();
            try
            {
                return this.status;
            }
            finally
            {
                rwlLock.ExitReadLock();
            }
        }
    }
}
